<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Hydra项目介绍 | anyang的博客</title>
    <meta name="description" content="千里之行,始于足下">
    <meta name="generator" content="VuePress 1.3.1">
    <link rel="icon" href="/img/favicon.ico">
  <script charset="utf-8" src="/js/main.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.slim.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.2/jquery.fancybox.min.js"></script>
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.2/jquery.fancybox.min.css">
  <meta name="keywords" content="福小林,奔奔,ourLang,CentOS,JAVA,vue组件,lsdCloud">
  <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-146891701-1"></script>
  <script>window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-146891701-1');</script>
  <script>var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?56eae8eec590ccaef1d5ff99d766f315";
        var s = document.getElementsByTagName("script")[0]; 
        s.parentNode.insertBefore(hm, s);
      })();</script>
    
    <link rel="preload" href="/assets/css/0.styles.9fff9873.css" as="style"><link rel="preload" href="/assets/js/app.1bc80adb.js" as="script"><link rel="preload" href="/assets/js/2.7c0608ab.js" as="script"><link rel="preload" href="/assets/js/38.f76063aa.js" as="script"><link rel="prefetch" href="/assets/js/10.81caa2ab.js"><link rel="prefetch" href="/assets/js/100.05bb269d.js"><link rel="prefetch" href="/assets/js/101.3e18b4d6.js"><link rel="prefetch" href="/assets/js/102.c7d7ed9c.js"><link rel="prefetch" href="/assets/js/103.4c771ce7.js"><link rel="prefetch" href="/assets/js/104.a2acd367.js"><link rel="prefetch" href="/assets/js/105.63399350.js"><link rel="prefetch" href="/assets/js/106.8a4744cc.js"><link rel="prefetch" href="/assets/js/107.7739d796.js"><link rel="prefetch" href="/assets/js/108.8008ae33.js"><link rel="prefetch" href="/assets/js/109.01c63898.js"><link rel="prefetch" href="/assets/js/11.7b837560.js"><link rel="prefetch" href="/assets/js/110.ad01aca9.js"><link rel="prefetch" href="/assets/js/111.3d74db70.js"><link rel="prefetch" href="/assets/js/112.67f55c34.js"><link rel="prefetch" href="/assets/js/113.016cd3c0.js"><link rel="prefetch" href="/assets/js/114.860e4b2b.js"><link rel="prefetch" href="/assets/js/115.b2f26258.js"><link rel="prefetch" href="/assets/js/116.8bea67b4.js"><link rel="prefetch" href="/assets/js/117.20682843.js"><link rel="prefetch" href="/assets/js/118.86a22e16.js"><link rel="prefetch" href="/assets/js/119.ad518bea.js"><link rel="prefetch" href="/assets/js/12.8fd78714.js"><link rel="prefetch" href="/assets/js/120.f97dd86f.js"><link rel="prefetch" href="/assets/js/121.c5601b4a.js"><link rel="prefetch" href="/assets/js/122.2889645a.js"><link rel="prefetch" href="/assets/js/13.ebf26820.js"><link rel="prefetch" href="/assets/js/14.b92dca09.js"><link rel="prefetch" href="/assets/js/15.b3dcef45.js"><link rel="prefetch" href="/assets/js/16.50378990.js"><link rel="prefetch" href="/assets/js/17.056bba2b.js"><link rel="prefetch" href="/assets/js/18.9047bb38.js"><link rel="prefetch" href="/assets/js/19.ab53b0fe.js"><link rel="prefetch" href="/assets/js/20.fe0b8af0.js"><link rel="prefetch" href="/assets/js/21.20a702f3.js"><link rel="prefetch" href="/assets/js/22.0ee08d29.js"><link rel="prefetch" href="/assets/js/23.02039a9a.js"><link rel="prefetch" href="/assets/js/24.363d3d74.js"><link rel="prefetch" href="/assets/js/25.dd6b101e.js"><link rel="prefetch" href="/assets/js/26.20493714.js"><link rel="prefetch" href="/assets/js/27.708723e5.js"><link rel="prefetch" href="/assets/js/28.4561834a.js"><link rel="prefetch" href="/assets/js/29.15cfcf5f.js"><link rel="prefetch" href="/assets/js/3.8d39d40c.js"><link rel="prefetch" href="/assets/js/30.04ab69de.js"><link rel="prefetch" href="/assets/js/31.b11c4302.js"><link rel="prefetch" href="/assets/js/32.81ae74ee.js"><link rel="prefetch" href="/assets/js/33.ddf09cc0.js"><link rel="prefetch" href="/assets/js/34.bc3549f7.js"><link rel="prefetch" href="/assets/js/35.4a0e0ebd.js"><link rel="prefetch" href="/assets/js/36.961a1c50.js"><link rel="prefetch" href="/assets/js/37.d8658de5.js"><link rel="prefetch" href="/assets/js/39.73edd08f.js"><link rel="prefetch" href="/assets/js/4.916af9bf.js"><link rel="prefetch" href="/assets/js/40.72314bff.js"><link rel="prefetch" href="/assets/js/41.c5eb1147.js"><link rel="prefetch" href="/assets/js/42.07aeafbb.js"><link rel="prefetch" href="/assets/js/43.c4a652ba.js"><link rel="prefetch" href="/assets/js/44.91fbe22b.js"><link rel="prefetch" href="/assets/js/45.6eecf0c4.js"><link rel="prefetch" href="/assets/js/46.81b7f108.js"><link rel="prefetch" href="/assets/js/47.b4468ab3.js"><link rel="prefetch" href="/assets/js/48.df205f23.js"><link rel="prefetch" href="/assets/js/49.7df59fa3.js"><link rel="prefetch" href="/assets/js/5.4fcd540a.js"><link rel="prefetch" href="/assets/js/50.0dc2fc5b.js"><link rel="prefetch" href="/assets/js/51.1ffabe54.js"><link rel="prefetch" href="/assets/js/52.2269d284.js"><link rel="prefetch" href="/assets/js/53.81b23843.js"><link rel="prefetch" href="/assets/js/54.b3249def.js"><link rel="prefetch" href="/assets/js/55.50dcf2af.js"><link rel="prefetch" href="/assets/js/56.c399c272.js"><link rel="prefetch" href="/assets/js/57.024f1dbb.js"><link rel="prefetch" href="/assets/js/58.680c6cf4.js"><link rel="prefetch" href="/assets/js/59.2291e9d7.js"><link rel="prefetch" href="/assets/js/6.7610d1d4.js"><link rel="prefetch" href="/assets/js/60.e59a26c1.js"><link rel="prefetch" href="/assets/js/61.ff5c64e4.js"><link rel="prefetch" href="/assets/js/62.7d97062c.js"><link rel="prefetch" href="/assets/js/63.6456dc7e.js"><link rel="prefetch" href="/assets/js/64.0b055680.js"><link rel="prefetch" href="/assets/js/65.9f25601c.js"><link rel="prefetch" href="/assets/js/66.cd973084.js"><link rel="prefetch" href="/assets/js/67.9b8f9716.js"><link rel="prefetch" href="/assets/js/68.d6c1869a.js"><link rel="prefetch" href="/assets/js/69.0a3688dd.js"><link rel="prefetch" href="/assets/js/7.9ebbd956.js"><link rel="prefetch" href="/assets/js/70.22f48891.js"><link rel="prefetch" href="/assets/js/71.9eb4fda9.js"><link rel="prefetch" href="/assets/js/72.ca4fa80c.js"><link rel="prefetch" href="/assets/js/73.17d1ab37.js"><link rel="prefetch" href="/assets/js/74.139691db.js"><link rel="prefetch" href="/assets/js/75.08d0560f.js"><link rel="prefetch" href="/assets/js/76.61078c10.js"><link rel="prefetch" href="/assets/js/77.4482adcc.js"><link rel="prefetch" href="/assets/js/78.166f2c37.js"><link rel="prefetch" href="/assets/js/79.2c7d6b79.js"><link rel="prefetch" href="/assets/js/8.6f8916c2.js"><link rel="prefetch" href="/assets/js/80.80445c3f.js"><link rel="prefetch" href="/assets/js/81.14e3bae8.js"><link rel="prefetch" href="/assets/js/82.7dac687f.js"><link rel="prefetch" href="/assets/js/83.1dd2e78e.js"><link rel="prefetch" href="/assets/js/84.23b759de.js"><link rel="prefetch" href="/assets/js/85.7574f69f.js"><link rel="prefetch" href="/assets/js/86.102dac61.js"><link rel="prefetch" href="/assets/js/87.8f5d639e.js"><link rel="prefetch" href="/assets/js/88.e564cbbe.js"><link rel="prefetch" href="/assets/js/89.cd66eb78.js"><link rel="prefetch" href="/assets/js/9.baa162db.js"><link rel="prefetch" href="/assets/js/90.685c6878.js"><link rel="prefetch" href="/assets/js/91.b8d1b7ea.js"><link rel="prefetch" href="/assets/js/92.1faa374d.js"><link rel="prefetch" href="/assets/js/93.cf5ff33c.js"><link rel="prefetch" href="/assets/js/94.8a02aefb.js"><link rel="prefetch" href="/assets/js/95.1b379a5b.js"><link rel="prefetch" href="/assets/js/96.9fd67185.js"><link rel="prefetch" href="/assets/js/97.c5a6a5a1.js"><link rel="prefetch" href="/assets/js/98.9a231411.js"><link rel="prefetch" href="/assets/js/99.5b344cab.js">
    <link rel="stylesheet" href="/assets/css/0.styles.9fff9873.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">anyang的博客</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">
  主页
</a></div><div class="nav-item"><a href="/study-guide/introduction.html" class="nav-link">
  学习指南
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="技术分类" class="dropdown-title"><span class="title">技术分类</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/java/introduction.html" class="nav-link">
  Java
</a></li><li class="dropdown-item"><!----> <a href="/go/introduction.html" class="nav-link">
  Go
</a></li><li class="dropdown-item"><!----> <a href="/sql/introduction.html" class="nav-link">
  SQL
</a></li><li class="dropdown-item"><!----> <a href="/fhir/introduction.html" class="nav-link">
  FHIR
</a></li></ul></div></div><div class="nav-item"><a href="/blog/introduction.html" class="nav-link">
  个人博客
</a></div><div class="nav-item"><a href="/tool/developmentBox.html" class="nav-link">
  开发百宝箱
</a></div><div class="nav-item"><a href="/project/introduction.html" class="nav-link">
  项目分享
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1300378587&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external">
  其他合作
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="http://www.lsdcloud.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  友情网站
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://github.com/ourlang" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Github
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/anlexanyang" target="_blank" rel="noopener noreferrer" class="nav-link external">
  码云
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/qq_37493556" target="_blank" rel="noopener noreferrer" class="nav-link external">
  CSDN
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div><div class="nav-item"><a href="/linkExchanges/introduction.html" class="nav-link">
  友情链接
</a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">
  主页
</a></div><div class="nav-item"><a href="/study-guide/introduction.html" class="nav-link">
  学习指南
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="技术分类" class="dropdown-title"><span class="title">技术分类</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/java/introduction.html" class="nav-link">
  Java
</a></li><li class="dropdown-item"><!----> <a href="/go/introduction.html" class="nav-link">
  Go
</a></li><li class="dropdown-item"><!----> <a href="/sql/introduction.html" class="nav-link">
  SQL
</a></li><li class="dropdown-item"><!----> <a href="/fhir/introduction.html" class="nav-link">
  FHIR
</a></li></ul></div></div><div class="nav-item"><a href="/blog/introduction.html" class="nav-link">
  个人博客
</a></div><div class="nav-item"><a href="/tool/developmentBox.html" class="nav-link">
  开发百宝箱
</a></div><div class="nav-item"><a href="/project/introduction.html" class="nav-link">
  项目分享
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1300378587&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external">
  其他合作
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="http://www.lsdcloud.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  友情网站
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://github.com/ourlang" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Github
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/anlexanyang" target="_blank" rel="noopener noreferrer" class="nav-link external">
  码云
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/qq_37493556" target="_blank" rel="noopener noreferrer" class="nav-link external">
  CSDN
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div><div class="nav-item"><a href="/linkExchanges/introduction.html" class="nav-link">
  友情链接
</a></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/blog/introduction.html" class="sidebar-link">博主介绍</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Go</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/blog/Go/11  需求规格说明书.html" class="sidebar-link">权限需求规格说明书</a></li><li><a href="/blog/Go/12  用户中心kratos.html" class="sidebar-link">用户中心kratos</a></li><li><a href="/blog/Go/13  权限服务器keto.html" class="sidebar-link">权限服务器keto</a></li><li><a href="/blog/Go/14  Hydra项目介绍.html" class="active sidebar-link">Hydra项目介绍</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_1-代码下载" class="sidebar-link">1 代码下载</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_2-初始数据库" class="sidebar-link">2 初始数据库</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_2-1-编译项目成main-exe" class="sidebar-link">2.1 编译项目成main.exe</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_2-2-初始化数据库" class="sidebar-link">2.2 初始化数据库</a></li></ul></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_3-config-yaml详解" class="sidebar-link">3 config.yaml详解</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_4-启动项目" class="sidebar-link">4 启动项目</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_5-查看项目接口文档" class="sidebar-link">5 查看项目接口文档</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_6-前端项目" class="sidebar-link">6 前端项目</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_6-1-配置文件说明" class="sidebar-link">6.1 配置文件说明</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_6-2-前端目录结构说明" class="sidebar-link">6.2 前端目录结构说明</a></li></ul></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-部分接口说明" class="sidebar-link">7 部分接口说明</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-1-流程图说明" class="sidebar-link">7.1 流程图说明</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-2-创建oauth2客户端" class="sidebar-link">7.2 创建Oauth2客户端</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-3-获取oauth2客户端列表" class="sidebar-link">7.3 获取Oauth2客户端列表</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-4-获取单个oauth2客户端" class="sidebar-link">7.4 获取单个Oauth2客户端</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-5-客户端凭据授予" class="sidebar-link">7.5 客户端凭据授予</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-6-对access-token自省" class="sidebar-link">7.6 对access_token自省</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-7-oauth2-0授权代码授予" class="sidebar-link">7.7 OAuth2.0授权代码授予</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_7-8-执行oauth2-0授权代码流" class="sidebar-link">7.8 执行OAuth2.0授权代码流</a></li></ul></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-数据库设计文档" class="sidebar-link">8 数据库设计文档</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-1-客户端数据表hydra-client" class="sidebar-link">8.1 客户端数据表hydra_client</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-2-客户端迁移表hydra-client-migration" class="sidebar-link">8.2 客户端迁移表hydraclientmigration</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-3-jsonweb密钥数据表hydra-jwk" class="sidebar-link">8.3 jsonWeb密钥数据表hydra_jwk</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-4-jsonweb密钥迁移表hydra-jwk-migration" class="sidebar-link">8.4 jsonWeb密钥迁移表hydrajwkmigration</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-5-客户端授权码表hydra-oauth2-access" class="sidebar-link">8.5  客户端授权码表hydraoauth2access</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-6-同意认证迁移表hydra-oauth2-authentication-consent-migration" class="sidebar-link">8.6 同意认证迁移表hydraoauth2authenticationconsentmigration</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-7-身份验证请求表-hydra-oauth2-authentication-request" class="sidebar-link">8.7 身份验证请求表 hydraoauth2authentication_request</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-8-已处理身份验证请求hydra-oauth2-authentication-request-handled" class="sidebar-link">8.8 已处理身份验证请求hydraoauth2authenticationrequesthandled</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_8-9-身份验证会话hydra-oauth2-authentication-session" class="sidebar-link">8.9 身份验证会话hydraoauth2authentication_session</a></li></ul></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_9-oauth2第三方登录示例图" class="sidebar-link">9 Oauth2第三方登录示例图</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-测试oauth2授权服务" class="sidebar-link">10 测试Oauth2授权服务</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-1-客户端凭据授权方式" class="sidebar-link">10.1 客户端凭据授权方式</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-2-创建oauth-2-0客户端" class="sidebar-link">10.2 创建OAuth 2.0客户端</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-3-执行客户端凭据" class="sidebar-link">10.3 执行客户端凭据</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-4-执行令牌自省" class="sidebar-link">10.4 执行令牌自省</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-5-跳转到登录页面" class="sidebar-link">10.5 跳转到登录页面</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_10-6-登录页面" class="sidebar-link">10.6 登录页面</a></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#项目详细流程说明" class="sidebar-link">项目详细流程说明</a></li></ul></li><li class="sidebar-sub-header"><a href="/blog/Go/14  Hydra项目介绍.html#_11-参考资料" class="sidebar-link">11 参考资料</a></li></ul></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Java</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>CentOS</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>正则表达式</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>版本控制器</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>ElasticSearch</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Spring Cloud Alibaba</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="hydra项目介绍"><a href="#hydra项目介绍" class="header-anchor">#</a> Hydra项目介绍</h1> <div class="custom-block danger"><p class="custom-block-title">Hydra介绍</p> <p>ORY Hydra是经过强化，经过OpenID认证的OAuth 2.0服务器和OpenID Connect提供商，针对低延迟，高吞吐量和低资源消耗进行了优化。ORY Hydra 不是身份提供者（用户注册，用户登录，密码重置流程），而是通过登录和同意应用程序连接到您现有的身份提供者。以不同的语言实现登录和同意应用程序很容易，并且提供了示例性的同意应用程序（Go，Node）和 SDK。</p></div> <h2 id="_1-代码下载"><a href="#_1-代码下载" class="header-anchor">#</a> 1 代码下载</h2> <p><a href="https://github.com/ory/hydra" target="_blank" rel="noopener noreferrer">Hydra源码地址下载<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h2 id="_2-初始数据库"><a href="#_2-初始数据库" class="header-anchor">#</a> 2 初始数据库</h2> <h3 id="_2-1-编译项目成main-exe"><a href="#_2-1-编译项目成main-exe" class="header-anchor">#</a> 2.1 编译项目成main.exe</h3> <blockquote><p>进入到hydra项目根目录执行下面命令，会生成一个可执行文件main.exe</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>go build main.go
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_2-2-初始化数据库"><a href="#_2-2-初始化数据库" class="header-anchor">#</a> 2.2 初始化数据库</h3> <blockquote><p>进入到hydra项目根目录执行</p></blockquote> <h4 id="_2-2-1-用navicat创建一个数据库hydra"><a href="#_2-2-1-用navicat创建一个数据库hydra" class="header-anchor">#</a> 2.2.1 用Navicat创建一个数据库hydra</h4> <p><a data-fancybox="" title="创建数据库hydra" href="/img/goImage/hydra1.png"><img src="/img/goImage/hydra1.png" alt="创建数据库hydra"></a></p> <h4 id="_2-2-2-进行hydra项目数据迁移"><a href="#_2-2-2-进行hydra项目数据迁移" class="header-anchor">#</a> 2.2.2 进行hydra项目数据迁移</h4> <blockquote><p>输入对应的数据库连接信息进行数据迁移</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>main.exe migrate sql mysql://root:admin@tcp<span class="token punctuation">(</span><span class="token number">127.0</span>.0.1:3306<span class="token punctuation">)</span>/hydra
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_2-2-3-在navicat查看是否迁移成功"><a href="#_2-2-3-在navicat查看是否迁移成功" class="header-anchor">#</a> 2.2.3 在Navicat查看是否迁移成功</h4> <p><a data-fancybox="" title="在Navicat查看是否迁移成功" href="/img/goImage/hydra2.png"><img src="/img/goImage/hydra2.png" alt="在Navicat查看是否迁移成功"></a></p> <h2 id="_3-config-yaml详解"><a href="#_3-config-yaml详解" class="header-anchor">#</a> 3 config.yaml详解</h2> <div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code><span class="token comment"># ORY Hydra 项目配置文件</span>

<span class="token comment"># !!警告!! 此配置文件仅用于文档目的。不要在生产中使用它。作为所有配置项。</span>

<span class="token comment"># ORY Hydra可以使用配置文件和使用`--config path/to/config.yaml`传递文件位置进行配置。</span>
<span class="token comment"># 默认情况下，ORY Hydra将查找并加载文件 ~/.hydra.yaml。所有配置键也可以使用环境变量来设置。</span>

<span class="token comment">##   设置环境变量介绍开始   ##</span>
<span class="token comment"># 设置环境变量很容易：</span>
<span class="token comment">## Linux / OSX</span>
<span class="token comment">#</span>
<span class="token comment"># $ export MY_ENV_VAR=foo</span>
<span class="token comment"># $ hydra ...</span>
<span class="token comment">#</span>
<span class="token comment"># 或者:</span>
<span class="token comment"># $ MY_ENV_VAR=foo hydra ...</span>
<span class="token comment">#</span>
<span class="token comment">## Windows</span>
<span class="token comment">#</span>
<span class="token comment">### 打开命令提示符</span>
<span class="token comment">#</span>
<span class="token comment"># &gt; set MY_ENV_VAR=foo</span>
<span class="token comment"># &gt; hydra ...</span>
<span class="token comment">#</span>
<span class="token comment">### Powershell</span>
<span class="token comment">#</span>
<span class="token comment"># &gt; $env:MY_ENV_VAR=&quot;foo&quot;</span>
<span class="token comment"># &gt; hydra ...</span>
<span class="token comment">#</span>
<span class="token comment">## Docker</span>
<span class="token comment">#</span>
<span class="token comment"># $ docker run -e MY_ENV_VAR=foo oryd/hydra:...</span>
<span class="token comment">#</span>
<span class="token comment">##  设置环境变量介绍结束   ##</span>

<span class="token comment"># 假设配置布局如下：</span>
<span class="token comment">#</span>
<span class="token comment"># serve:</span>
<span class="token comment">#   public:</span>
<span class="token comment">#     port: 4444</span>
<span class="token comment">#     something_else: foobar</span>
<span class="token comment">#</span>
<span class="token comment"># 键“something_else”可以通过在其路径上加上标记设置为环境变量：</span>
<span class="token comment">#   `serve.public.port.somethihng_else` -&gt; `SERVE.PUBLIC.PORT.SOMETHING_ELSE`</span>
<span class="token comment"># 和替换 `.` with `_`:</span>
<span class="token comment">#   `serve.public.port.somethihng_else` -&gt; `SERVE_PUBLIC_PORT_SOMETHING_ELSE`</span>
<span class="token comment">#</span>
<span class="token comment"># 环境变量总是重写配置文件中的值。以下是更多的例子：</span>
<span class="token comment">#</span>
<span class="token comment"># Configuration key | Environment variable |</span>
<span class="token comment"># ------------------|----------------------|</span>
<span class="token comment"># dsn               | DSN                  |</span>
<span class="token comment"># serve.admin.host  | SERVE_ADMIN_HOST     |</span>
<span class="token comment"># ------------------|----------------------|</span>
<span class="token comment">#</span>
<span class="token comment">#</span>
<span class="token comment"># 清单项目，例如</span>
<span class="token comment">#</span>
<span class="token comment"># secrets:</span>
<span class="token comment">#   system:</span>
<span class="token comment">#     - this-is-the-primary-secret</span>
<span class="token comment">#     - this-is-an-old-secret</span>
<span class="token comment">#     - this-is-another-old-secret</span>
<span class="token comment">#</span>
<span class="token comment"># 在使用环境变量时，必须使用','分隔。相当于代码部分#的环境变量 以上是：</span>
<span class="token comment">#</span>
<span class="token comment"># Linux/macOS: $ export SECRETS_SYSTEM=this-is-the-primary-secret,this-is-an-old-secret,this-is-another-old-secret</span>
<span class="token comment"># Windows: &gt; set SECRETS_SYSTEM=this-is-the-primary-secret,this-is-an-old-secret,this-is-another-old-secret</span>

<span class="token comment"># 日志配置日志记录器</span>
<span class="token key atrule">log</span><span class="token punctuation">:</span>
 <span class="token comment"># 设置日志级别，参数支持 &quot;panic&quot;, &quot;fatal&quot;, &quot;error&quot;, &quot;warn&quot;, &quot;info&quot; and &quot;debug&quot;.默认&quot;info&quot;级别</span>
  <span class="token key atrule">level</span><span class="token punctuation">:</span> info
  <span class="token comment"># 设置日志格式。未定义基于文本的日志格式，或设置为JSON格式。</span>
  <span class="token key atrule">format</span><span class="token punctuation">:</span> json

<span class="token comment"># 服务控制http（s）守护进程的配置</span>
<span class="token key atrule">serve</span><span class="token punctuation">:</span>
  <span class="token comment"># 公共控制为公共API端点服务的公共守护进程，比如 /oauth2/auth, /oauth2/token, /.well-known/jwks.json</span>
  <span class="token key atrule">public</span><span class="token punctuation">:</span>
    <span class="token comment"># 公共API端点服务监听的端口号，默认是4444</span>
    <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">4444</span>
    <span class="token comment"># 接口或 Unix socket ory Hydra应该侦听并处理公共API请求。</span>
    <span class="token comment"># 使用前缀“unix：”指定unix socket的路径。 在所有接口上留下空的侦听器。</span>
    <span class="token key atrule">host</span><span class="token punctuation">:</span> localhost <span class="token comment"># 在默认的所有设备上，请将此删除或空以侦听</span>
    <span class="token comment"># host: unix:/path/to/socket</span>

    <span class="token comment"># Cors为公共端点配置跨域资源共享。</span>
    <span class="token key atrule">cors</span><span class="token punctuation">:</span>
      <span class="token comment"># 将启用的设置为true以启用CORS。默认为false。</span>
      <span class="token key atrule">enabled</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
     <span class="token comment"># allowed_origins是一个可以执行跨域请求的起源列表（逗号分隔值）。</span>
     <span class="token comment"># 如果清单中有特殊的*值，则将允许所有起源。原点可以包含一个通配符（*）来替换0个或更多个字符（即。http://*.domain.com）。</span>
     <span class="token comment"># 每个起源只能使用一个通配符。如果为空或未定义，则默认为‘*’，允许来自每个域的CORS（如果启用CORS：true）。</span>
      <span class="token key atrule">allowed_origins</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> https<span class="token punctuation">:</span>//example.com
        <span class="token punctuation">-</span> https<span class="token punctuation">:</span>//*.example.com
      <span class="token comment">#允许方法是允许用户代理与跨域一起使用的HTTP方法列表请求。默认为列出的方法。</span>
      <span class="token key atrule">allowed_methods</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> POST
        <span class="token punctuation">-</span> GET
        <span class="token punctuation">-</span> PUT
        <span class="token punctuation">-</span> PATCH
        <span class="token punctuation">-</span> DELETE

      <span class="token comment"># 允许客户端在跨域请求中使用的非简单标头列表。默认为列出的值。</span>
      <span class="token key atrule">allowed_headers</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> Authorization
        <span class="token punctuation">-</span> Content<span class="token punctuation">-</span>Type

      <span class="token comment"># 设置哪些标题（逗号分隔的值）安全地公开给CORSAPI规范的API。默认为列出的值。</span>
      <span class="token key atrule">exposed_headers</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> Content<span class="token punctuation">-</span>Type

      <span class="token comment">#设置请求是否可以包括用户凭据，如cookie、HTTP身份验证或客户端SSL证书。默认为true</span>
      <span class="token key atrule">allow_credentials</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
      <span class="token comment"># 设置可以缓存飞行前请求的结果的时间（以秒为单位）。</span>
      <span class="token comment"># 如果设置为0，每个请求在之前有一个飞行前请求。默认为0。</span>
      <span class="token key atrule">max_age</span><span class="token punctuation">:</span> <span class="token number">10</span>

      <span class="token comment"># 如果设置为true，则添加额外的日志输出以调试服务器端CORS问题。默认为false。</span>
      <span class="token key atrule">debug</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>

    <span class="token comment"># 公共服务器的访问日志配置。</span>
    <span class="token key atrule">access_log</span><span class="token punctuation">:</span>
      <span class="token comment"># 禁用健康端点的访问日志。</span>
      <span class="token key atrule">disable_for_health</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>

      <span class="token comment"># admin控制为adminAPI端点服务的admin守护进程，如 /jwk, /client, ...</span>
  <span class="token key atrule">admin</span><span class="token punctuation">:</span>
    <span class="token comment"># admin API端点服务监听的端口号，默认是4445</span>
    <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">4445</span>
    <span class="token comment"># 接口或unix套接字ory Hydra应该侦听并处理管理API请求。</span>
    <span class="token comment">#使用前缀&quot;unix&quot;指定unix套接字的路径。在所有接口上留下空的侦听器。</span>
    <span class="token key atrule">host</span><span class="token punctuation">:</span> localhost <span class="token comment"># 省略或空听所有的设备，这是默认的。</span>
    <span class="token comment"># host: unix:/path/to/socket</span>

    <span class="token comment"># cors配置 Cross Origin资源共享的admin端点.</span>
    <span class="token key atrule">cors</span><span class="token punctuation">:</span>
      <span class="token comment"># 将启用的设置为true以启用CORS。默认为false。</span>
      <span class="token key atrule">enabled</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
      <span class="token comment"># allowed_origins是可以从中执行跨域请求的源（逗号分隔值）列表。</span>
      <span class="token comment">#如果列表中存在特殊*值，则允许所有原点。原点可以包含通配符（*）</span>
      <span class="token comment">#替换0个或多个字符（即：http://*.domain.com）。每个原点只能使用一个通配符。</span>
      <span class="token comment"># 如果为空或未定义，则默认为“*”，允许来自每个域的CORS（如果CORS.enabled:true）。</span>
      <span class="token key atrule">allowed_origins</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> https<span class="token punctuation">:</span>//example.com
        <span class="token punctuation">-</span> https<span class="token punctuation">:</span>//*.example.com
      <span class="token comment"># allowed_methods是允许用户代理跨域使用的HTTP方法的列表请求。默认为 GET and POST.</span>
      <span class="token key atrule">allowed_methods</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> POST
        <span class="token punctuation">-</span> GET
        <span class="token punctuation">-</span> PUT
        <span class="token punctuation">-</span> PATCH
        <span class="token punctuation">-</span> DELETE

      <span class="token comment">#允许客户端用于跨域请求的非简单头列表。默认为列出的值。</span>
      <span class="token key atrule">allowed_headers</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> Authorization
        <span class="token punctuation">-</span> Content<span class="token punctuation">-</span>Type

      <span class="token comment"># 设置哪些头（逗号分隔值）可以安全地公开给CORS API规范的API。默认为列出的值。</span>
      <span class="token key atrule">exposed_headers</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> Content<span class="token punctuation">-</span>Type

    <span class="token comment">#设置请求是否可以包括用户凭据，如cookies、HTTP身份验证或客户端SSL证书。</span>
      <span class="token key atrule">allow_credentials</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
      <span class="token comment">#设置可以缓存飞行前请求的结果的时间（秒）。如果设置为0，则每个请求在飞行前请求。默认为0。</span>
      <span class="token key atrule">max_age</span><span class="token punctuation">:</span> <span class="token number">10</span>

      <span class="token comment"># 如果设置为true，则会向调试服务器端CORS问题添加其他日志输出。默认为false。</span>
      <span class="token key atrule">debug</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>

    <span class="token comment"># 管理服务器的访问日志配置。</span>
    <span class="token key atrule">access_log</span><span class="token punctuation">:</span>
      <span class="token comment"># 禁用健康终结点的访问日志。</span>
      <span class="token key atrule">disable_for_health</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>

  <span class="token comment"># tls配置HTTPS（HTTP over tls）。如果已配置，服务器将自动支持HTTP/2。</span>
  <span class="token key atrule">tls</span><span class="token punctuation">:</span>
    <span class="token comment"># 密钥配置私钥（pem编码）</span>
    <span class="token key atrule">key</span><span class="token punctuation">:</span>
      <span class="token comment"># 密钥可以从文件加载：生成秘钥网站 https://www.selfsignedcertificate.com/</span>
      <span class="token key atrule">path</span><span class="token punctuation">:</span> ./docs/hydra_private.key
      <span class="token comment"># 或来自base64编码（不带填充）字符串：</span>
      <span class="token comment">#base64: LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLVxuTUlJRkRqQkFCZ2txaGtpRzl3MEJCUTB3...</span>

    <span class="token comment"># cert configures the TLS certificate (PEM encoded)</span>
    <span class="token key atrule">cert</span><span class="token punctuation">:</span>
      <span class="token comment"># 证书可以从文件中加载：生成秘钥网站 https://www.selfsignedcertificate.com/</span>
      <span class="token key atrule">path</span><span class="token punctuation">:</span> ./docs/hydra_certificate.cert
      <span class="token comment"># 或来自base64编码（不带填充）字符串：</span>
      <span class="token comment">#base64: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tXG5NSUlEWlRDQ0FrMmdBd0lCQWdJRVY1eE90REFOQmdr...</span>

    <span class="token comment">#白名单一个或多个CIDR地址范围，并允许他们终止TLS连接。</span>
    <span class="token comment">#请注意，必须设置X-Forwarded-Proto头，并且除了您的代理/网关/负载平衡器。支持ipv4和ipv6。</span>
    <span class="token comment">#</span>
    <span class="token comment"># 当设置此选项时，Hydra提供http而不是https。</span>
    <span class="token comment"># 有关更多信息，请访问：https://www.ory.sh/docs/hydra/production#tls-termination</span>
    <span class="token key atrule">allow_termination_from</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> 127.0.0.1/32

<span class="token comment"># dsn设置数据源名称。这将配置ORY Hydra保存数据的后端。</span>
<span class="token comment">#</span>
<span class="token comment">## 内存数据库</span>
<span class="token comment">#</span>
<span class="token comment"># 如果dsn是“内存”，则数据将写入内存，并在重新启动此实例时丢失。可以使用DSN环境变量设置此值：</span>
<span class="token comment">#</span>
<span class="token comment">## SQL数据库</span>
<span class="token comment">#</span>
<span class="token comment"># ORY Hydra支持流行的SQL数据库。有关更详细的配置信息，请转到：https://www.ory.sh/docs/hydra/dependencies-environment#sql</span>

<span class="token comment">#PostgreSQL（推荐）</span>
<span class="token comment"># 如果dsn以 postgres:// PostgreSQL作为后端存储数据库：连接dsn示例如下</span>
<span class="token comment"># dsn: dsn=postgres://user:password@host:123/database</span>
<span class="token comment">#</span>
<span class="token comment">### MySQL数据库</span>
<span class="token comment"># 如果dsn以 mysql:// MySQL作为后端存储数据库:连接dsn示例如下</span>
<span class="token comment"># dsn: mysql://user:password@tcp(host:123)/database</span>


<span class="token comment">### CockroachDB</span>
<span class="token comment"># 如果dsn以cockroach:// CockroachDB 作为后端存储数据库:连接dsn示例如下</span>
<span class="token comment"># dsn: cockroach://user:password@host:123/database</span>
<span class="token comment">#</span>
<span class="token key atrule">dsn</span><span class="token punctuation">:</span> mysql<span class="token punctuation">:</span>//root<span class="token punctuation">:</span>admin@tcp(127.0.0.1<span class="token punctuation">:</span>3306)/hydra

<span class="token comment"># webfinger配置./well-known/settings</span>
<span class="token key atrule">webfinger</span><span class="token punctuation">:</span>
  <span class="token comment"># jwks配置/.well-known/jwks.json端点。</span>
  <span class="token key atrule">jwks</span><span class="token punctuation">:</span>
    <span class="token comment"># 广播密钥是应该在该端点公开的JSON Web密钥列表。这通常是</span>
    <span class="token comment">#用于验证OpenID Connect ID令牌的公钥。但是，您可能还需要在此处添加其他键。</span>
    <span class="token key atrule">broadcast_keys</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> hydra.openid.id<span class="token punctuation">-</span>token <span class="token comment"># 默认情况下，此密钥始终公开</span>
      <span class="token comment"># - hydra.jwt.access-token # 当OAuth2访问令牌策略设置为JWT时，将公开此密钥。</span>

  <span class="token comment">#oidc_discovery配置OpenID Connect discovery（/.well-known/OpenID配置）</span>
  <span class="token key atrule">oidc_discovery</span><span class="token punctuation">:</span>
    <span class="token key atrule">client_registration_url</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>service.com/clients
    <span class="token comment"># 要广播的受支持声明的列表。始终包括声明“sub”：</span>
    <span class="token key atrule">supported_claims</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> email
      <span class="token punctuation">-</span> username
    <span class="token comment"># 作用域OAuth 2.0客户端可以请求。始终包括作用域“offline”、“offline\u access”和“openid”。</span>
    <span class="token key atrule">supported_scope</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> email
      <span class="token punctuation">-</span> whatever
      <span class="token punctuation">-</span> read.photos

    <span class="token comment"># 要在OpenID Connect上公布的userinfo端点的URL发现终结点/.well-known/openid配置。</span>
    <span class="token comment"># 默认为ORY Hydra的userinfo端点，位于/userinfo。如果要自己处理此终结点，请设置此值。</span>
    <span class="token key atrule">userinfo_url</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//example.org/my<span class="token punctuation">-</span>custom<span class="token punctuation">-</span>userinfo<span class="token punctuation">-</span>endpoint

<span class="token comment"># oidc配置OpenID Connect特性。</span>
<span class="token key atrule">oidc</span><span class="token punctuation">:</span>
  <span class="token comment"># subject_identifiers配置subject Identifier算法。</span>
  <span class="token comment"># 有关更多信息，请参阅文档：https://www.ory.sh/docs/hydra/advanced#subject-identifier-algorithms</span>
  <span class="token key atrule">subject_identifiers</span><span class="token punctuation">:</span>
    <span class="token comment"># 要启用哪些算法。默认为&quot;public&quot;</span>
    <span class="token key atrule">enabled</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> pairwise
      <span class="token punctuation">-</span> public
    <span class="token comment"># 配置成对算法</span>
    <span class="token key atrule">pairwise</span><span class="token punctuation">:</span>
      <span class="token comment"># 如果启用“成对”，则必须定义 salt属性</span>
      <span class="token key atrule">salt</span><span class="token punctuation">:</span> some<span class="token punctuation">-</span>random<span class="token punctuation">-</span>salt

  <span class="token comment">#动态客户机注册配置OpenID Connect动态客户机注册（公开为管理端点/clients/…）</span>
  <span class="token key atrule">dynamic_client_registration</span><span class="token punctuation">:</span>

    <span class="token comment"># OpenID Connect动态客户端注册规范没有白名单OAuth 2.0范围的概念。</span>
    <span class="token comment"># 如果你要公开动态客户端注册，应为新注册的客户端设置启用的默认作用域。</span>
    <span class="token comment"># 请记住，用户可以通过在注册负载中设置“scope”键来覆盖此默认值，有效地禁用白名单作用域的概念。</span>
    <span class="token key atrule">default_scope</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> openid
      <span class="token punctuation">-</span> offline
      <span class="token punctuation">-</span> offline_access

<span class="token key atrule">urls</span><span class="token punctuation">:</span>
  <span class="token key atrule">self</span><span class="token punctuation">:</span>
    <span class="token comment"># 此值将用作访问和ID令牌中的&quot;issuer&quot;。一定是指定并使用HTTPS协议，除非设置了--dangerous-force-http 。</span>
    <span class="token comment"># 这通常应该是相等的为了公众的价值。</span>
    <span class="token key atrule">issuer</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span>4444/

    <span class="token comment"># 这是ORY Hydra安装的公共终结点的基本位置。这通常应该是相等的对发行人的价值。</span>
    <span class="token comment"># 如果未指定，则返回到颁发者值。</span>
    <span class="token key atrule">public</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span>4444/

  <span class="token comment"># 设置login属性为 用户登录和同意流的终结点。默认为内部回退URL。</span>
  <span class="token key atrule">login</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>login.app/login
  <span class="token comment"># 设置consent节点属性， 用户登录和同意流的终结点。默认为内部回退URL。</span>
  <span class="token key atrule">consent</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>consent.app/consent
  <span class="token comment"># 设置注销终结点。默认为内部回退URL。</span>
  <span class="token key atrule">logout</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>logout.app/logout
  <span class="token comment"># 设置错误端点。当发生OAuth2错误而无法发回时，将显示错误页面给客户。默认为内部回退URL。</span>
  <span class="token key atrule">error</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>error.app/error
  <span class="token comment"># 当用户代理请求注销时，它将在默认情况下重定向到此url。</span>
  <span class="token key atrule">post_logout_redirect</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//my<span class="token punctuation">-</span>example.app/logout<span class="token punctuation">-</span>successful

<span class="token key atrule">strategies</span><span class="token punctuation">:</span>
  <span class="token key atrule">scope</span><span class="token punctuation">:</span> DEPRECATED_HIERARCHICAL_SCOPE_STRATEGY
  <span class="token comment"># 您可以使用JSON Web令牌作为访问令牌。</span>
  <span class="token comment"># 但说真的。别那么做。这不是一个好主意，有很多警告和微妙的安全影响。阅读更多： https://www.ory.sh/docs/hydra/advanced#json-web-tokens</span>
  <span class="token comment">#</span>
  <span class="token comment">#  access_token: jwt</span>

<span class="token comment"># 配置生存时间</span>
<span class="token key atrule">ttl</span><span class="token punctuation">:</span>
  <span class="token comment"># 配置用户登录和同意流可能需要多长时间。默认为1小时。</span>
  <span class="token key atrule">login_consent_request</span><span class="token punctuation">:</span> 1h
  <span class="token comment"># 配置访问令牌有效的时间。默认为1小时。</span>
  <span class="token key atrule">access_token</span><span class="token punctuation">:</span> 1h
  <span class="token comment"># 配置刷新令牌有效的时间。默认值为720h。设置为-1可使刷新令牌永不过期。</span>
  <span class="token key atrule">refresh_token</span><span class="token punctuation">:</span> 720h
  <span class="token comment"># 配置标识令牌有效的时间。默认为1小时。</span>
  <span class="token key atrule">id_token</span><span class="token punctuation">:</span> 1h
  <span class="token comment"># 配置验证代码有效的时间。默认值为10秒。</span>
  <span class="token key atrule">auth_code</span><span class="token punctuation">:</span> 10m

<span class="token key atrule">oauth2</span><span class="token punctuation">:</span>
  <span class="token comment">#如果要与OAuth 2.0客户端共享错误调试信息，请将此设置为true。</span>
  <span class="token comment">#请记住，在处理错误时，调试信息非常有价值，但也可能会暴露数据库错误、代码和类似错误。默认为false。</span>
  <span class="token key atrule">expose_internal_errors</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token comment"># 配置哈希算法。目前只支持BCrypt</span>
  <span class="token key atrule">hashers</span><span class="token punctuation">:</span>
    <span class="token comment"># 配置用于哈希客户端机密的BCrypt哈希算法。</span>
    <span class="token key atrule">bcrypt</span><span class="token punctuation">:</span>
      <span class="token comment"># 设置BCrypt成本。最小值为4，默认值为10。值越高，CPU时间就越多，用于生成哈希.</span>
      <span class="token key atrule">cost</span><span class="token punctuation">:</span> <span class="token number">10</span>
  <span class="token key atrule">pkce</span><span class="token punctuation">:</span>
    <span class="token comment"># 如果希望对所有客户端强制执行PKCE，请将此设置为true。</span>
    <span class="token key atrule">enforced</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>

<span class="token comment"># secrets部分配置用于对多个系统进行加密和签名的机密。所有的秘密都可以旋转，</span>
<span class="token comment">#有关此主题的详细信息，请导航到： https://www.ory.sh/docs/hydra/advanced#rotation-of-hmac-token-signing-and-database-and-cookie-encryption-keys</span>
<span class="token key atrule">secrets</span><span class="token punctuation">:</span>
  <span class="token comment">#系统机密的长度必须至少为16个字符。如果没有提供，将生成一个。</span>
  <span class="token comment"># 它们是钥匙用于使用AES-GCM（256位）加密敏感数据并验证HMAC签名。</span>
  <span class="token comment">#列表中的第一项用于签名和加密。整个列表用于验证签名还有解密。</span>
  <span class="token key atrule">system</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>the<span class="token punctuation">-</span>primary<span class="token punctuation">-</span>secret
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>an<span class="token punctuation">-</span>old<span class="token punctuation">-</span>secret
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>another<span class="token punctuation">-</span>old<span class="token punctuation">-</span>secret
  <span class="token comment">#用于加密cookie会话的机密。默认为secrets.system。建议使用一个单独的生产秘密。</span>
  <span class="token comment">#列表中的第一项用于签名和加密。整个列表用于验证签名还有解密。</span>
  <span class="token key atrule">cookie</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>the<span class="token punctuation">-</span>primary<span class="token punctuation">-</span>secret
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>an<span class="token punctuation">-</span>old<span class="token punctuation">-</span>secret
    <span class="token punctuation">-</span> this<span class="token punctuation">-</span>is<span class="token punctuation">-</span>another<span class="token punctuation">-</span>old<span class="token punctuation">-</span>secret

<span class="token comment"># 如果已设置，则启用分析。使用“cpu”启用cpu分析，使用“mem”启用内存分析。更多细节在分析时，转到： https://blog.golang.org/profiling-go-programs</span>
<span class="token key atrule">profiling</span><span class="token punctuation">:</span> cpu
<span class="token comment"># profiling: mem</span>

<span class="token comment">#ORY Hydra支持分布式跟踪。</span>
<span class="token key atrule">tracing</span><span class="token punctuation">:</span>
  <span class="token comment"># 将此设置为要使用的跟踪后端。目前支持jaeger。如果省略或为空，则跟踪将被禁用。</span>
  <span class="token key atrule">provider</span><span class="token punctuation">:</span> jaeger
  <span class="token comment"># 指定要在跟踪程序上使用的服务名称。</span>
  <span class="token key atrule">service_name</span><span class="token punctuation">:</span> ORY Hydra
  <span class="token key atrule">providers</span><span class="token punctuation">:</span>
    <span class="token comment"># 配置jaeger跟踪后端。</span>
    <span class="token key atrule">jaeger</span><span class="token punctuation">:</span>
      <span class="token comment"># jaeger代理应将spans发送到的地址</span>
      <span class="token key atrule">local_agent_address</span><span class="token punctuation">:</span> 127.0.0.1<span class="token punctuation">:</span><span class="token number">6831</span>
      <span class="token comment"># 跟踪头格式</span>
      <span class="token key atrule">propagation</span><span class="token punctuation">:</span> jaeger
      <span class="token key atrule">sampling</span><span class="token punctuation">:</span>
        <span class="token comment"># 要使用的采样器的类型。支持：</span>
        <span class="token comment"># - const</span>
        <span class="token comment"># - probabilistic</span>
        <span class="token comment"># - ratelimiting</span>
        <span class="token key atrule">type</span><span class="token punctuation">:</span> const
        <span class="token comment"># 传递给已配置的采样器类型的值。支持的值：这取决于使用的采样策略：</span>
        <span class="token comment"># - const: 0 or 1 (全有或全无)</span>
        <span class="token comment">#  rateLimiting（速率限制）：恒定速率（例如，将此设置为3将以每秒3个跟踪的速率采样请求）</span>
        <span class="token comment"># - rateLimiting: 3</span>
        <span class="token comment"># 介于0~1之间的值，比如0.5</span>
        <span class="token comment"># - probabilistic: 0.5</span>
        <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token number">1.0</span>
        <span class="token comment"># jaeger代理的HTTP采样服务器的地址</span>
        <span class="token key atrule">server_url</span><span class="token punctuation">:</span> http<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span>5778/sampling
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br><span class="line-number">111</span><br><span class="line-number">112</span><br><span class="line-number">113</span><br><span class="line-number">114</span><br><span class="line-number">115</span><br><span class="line-number">116</span><br><span class="line-number">117</span><br><span class="line-number">118</span><br><span class="line-number">119</span><br><span class="line-number">120</span><br><span class="line-number">121</span><br><span class="line-number">122</span><br><span class="line-number">123</span><br><span class="line-number">124</span><br><span class="line-number">125</span><br><span class="line-number">126</span><br><span class="line-number">127</span><br><span class="line-number">128</span><br><span class="line-number">129</span><br><span class="line-number">130</span><br><span class="line-number">131</span><br><span class="line-number">132</span><br><span class="line-number">133</span><br><span class="line-number">134</span><br><span class="line-number">135</span><br><span class="line-number">136</span><br><span class="line-number">137</span><br><span class="line-number">138</span><br><span class="line-number">139</span><br><span class="line-number">140</span><br><span class="line-number">141</span><br><span class="line-number">142</span><br><span class="line-number">143</span><br><span class="line-number">144</span><br><span class="line-number">145</span><br><span class="line-number">146</span><br><span class="line-number">147</span><br><span class="line-number">148</span><br><span class="line-number">149</span><br><span class="line-number">150</span><br><span class="line-number">151</span><br><span class="line-number">152</span><br><span class="line-number">153</span><br><span class="line-number">154</span><br><span class="line-number">155</span><br><span class="line-number">156</span><br><span class="line-number">157</span><br><span class="line-number">158</span><br><span class="line-number">159</span><br><span class="line-number">160</span><br><span class="line-number">161</span><br><span class="line-number">162</span><br><span class="line-number">163</span><br><span class="line-number">164</span><br><span class="line-number">165</span><br><span class="line-number">166</span><br><span class="line-number">167</span><br><span class="line-number">168</span><br><span class="line-number">169</span><br><span class="line-number">170</span><br><span class="line-number">171</span><br><span class="line-number">172</span><br><span class="line-number">173</span><br><span class="line-number">174</span><br><span class="line-number">175</span><br><span class="line-number">176</span><br><span class="line-number">177</span><br><span class="line-number">178</span><br><span class="line-number">179</span><br><span class="line-number">180</span><br><span class="line-number">181</span><br><span class="line-number">182</span><br><span class="line-number">183</span><br><span class="line-number">184</span><br><span class="line-number">185</span><br><span class="line-number">186</span><br><span class="line-number">187</span><br><span class="line-number">188</span><br><span class="line-number">189</span><br><span class="line-number">190</span><br><span class="line-number">191</span><br><span class="line-number">192</span><br><span class="line-number">193</span><br><span class="line-number">194</span><br><span class="line-number">195</span><br><span class="line-number">196</span><br><span class="line-number">197</span><br><span class="line-number">198</span><br><span class="line-number">199</span><br><span class="line-number">200</span><br><span class="line-number">201</span><br><span class="line-number">202</span><br><span class="line-number">203</span><br><span class="line-number">204</span><br><span class="line-number">205</span><br><span class="line-number">206</span><br><span class="line-number">207</span><br><span class="line-number">208</span><br><span class="line-number">209</span><br><span class="line-number">210</span><br><span class="line-number">211</span><br><span class="line-number">212</span><br><span class="line-number">213</span><br><span class="line-number">214</span><br><span class="line-number">215</span><br><span class="line-number">216</span><br><span class="line-number">217</span><br><span class="line-number">218</span><br><span class="line-number">219</span><br><span class="line-number">220</span><br><span class="line-number">221</span><br><span class="line-number">222</span><br><span class="line-number">223</span><br><span class="line-number">224</span><br><span class="line-number">225</span><br><span class="line-number">226</span><br><span class="line-number">227</span><br><span class="line-number">228</span><br><span class="line-number">229</span><br><span class="line-number">230</span><br><span class="line-number">231</span><br><span class="line-number">232</span><br><span class="line-number">233</span><br><span class="line-number">234</span><br><span class="line-number">235</span><br><span class="line-number">236</span><br><span class="line-number">237</span><br><span class="line-number">238</span><br><span class="line-number">239</span><br><span class="line-number">240</span><br><span class="line-number">241</span><br><span class="line-number">242</span><br><span class="line-number">243</span><br><span class="line-number">244</span><br><span class="line-number">245</span><br><span class="line-number">246</span><br><span class="line-number">247</span><br><span class="line-number">248</span><br><span class="line-number">249</span><br><span class="line-number">250</span><br><span class="line-number">251</span><br><span class="line-number">252</span><br><span class="line-number">253</span><br><span class="line-number">254</span><br><span class="line-number">255</span><br><span class="line-number">256</span><br><span class="line-number">257</span><br><span class="line-number">258</span><br><span class="line-number">259</span><br><span class="line-number">260</span><br><span class="line-number">261</span><br><span class="line-number">262</span><br><span class="line-number">263</span><br><span class="line-number">264</span><br><span class="line-number">265</span><br><span class="line-number">266</span><br><span class="line-number">267</span><br><span class="line-number">268</span><br><span class="line-number">269</span><br><span class="line-number">270</span><br><span class="line-number">271</span><br><span class="line-number">272</span><br><span class="line-number">273</span><br><span class="line-number">274</span><br><span class="line-number">275</span><br><span class="line-number">276</span><br><span class="line-number">277</span><br><span class="line-number">278</span><br><span class="line-number">279</span><br><span class="line-number">280</span><br><span class="line-number">281</span><br><span class="line-number">282</span><br><span class="line-number">283</span><br><span class="line-number">284</span><br><span class="line-number">285</span><br><span class="line-number">286</span><br><span class="line-number">287</span><br><span class="line-number">288</span><br><span class="line-number">289</span><br><span class="line-number">290</span><br><span class="line-number">291</span><br><span class="line-number">292</span><br><span class="line-number">293</span><br><span class="line-number">294</span><br><span class="line-number">295</span><br><span class="line-number">296</span><br><span class="line-number">297</span><br><span class="line-number">298</span><br><span class="line-number">299</span><br><span class="line-number">300</span><br><span class="line-number">301</span><br><span class="line-number">302</span><br><span class="line-number">303</span><br><span class="line-number">304</span><br><span class="line-number">305</span><br><span class="line-number">306</span><br><span class="line-number">307</span><br><span class="line-number">308</span><br><span class="line-number">309</span><br><span class="line-number">310</span><br><span class="line-number">311</span><br><span class="line-number">312</span><br><span class="line-number">313</span><br><span class="line-number">314</span><br><span class="line-number">315</span><br><span class="line-number">316</span><br><span class="line-number">317</span><br><span class="line-number">318</span><br><span class="line-number">319</span><br><span class="line-number">320</span><br><span class="line-number">321</span><br><span class="line-number">322</span><br><span class="line-number">323</span><br><span class="line-number">324</span><br><span class="line-number">325</span><br><span class="line-number">326</span><br><span class="line-number">327</span><br><span class="line-number">328</span><br><span class="line-number">329</span><br><span class="line-number">330</span><br><span class="line-number">331</span><br><span class="line-number">332</span><br><span class="line-number">333</span><br><span class="line-number">334</span><br><span class="line-number">335</span><br><span class="line-number">336</span><br><span class="line-number">337</span><br><span class="line-number">338</span><br><span class="line-number">339</span><br><span class="line-number">340</span><br><span class="line-number">341</span><br><span class="line-number">342</span><br><span class="line-number">343</span><br><span class="line-number">344</span><br><span class="line-number">345</span><br><span class="line-number">346</span><br><span class="line-number">347</span><br><span class="line-number">348</span><br><span class="line-number">349</span><br><span class="line-number">350</span><br><span class="line-number">351</span><br><span class="line-number">352</span><br><span class="line-number">353</span><br><span class="line-number">354</span><br><span class="line-number">355</span><br><span class="line-number">356</span><br><span class="line-number">357</span><br><span class="line-number">358</span><br><span class="line-number">359</span><br><span class="line-number">360</span><br><span class="line-number">361</span><br><span class="line-number">362</span><br><span class="line-number">363</span><br><span class="line-number">364</span><br><span class="line-number">365</span><br><span class="line-number">366</span><br><span class="line-number">367</span><br><span class="line-number">368</span><br><span class="line-number">369</span><br><span class="line-number">370</span><br><span class="line-number">371</span><br><span class="line-number">372</span><br><span class="line-number">373</span><br><span class="line-number">374</span><br><span class="line-number">375</span><br><span class="line-number">376</span><br><span class="line-number">377</span><br><span class="line-number">378</span><br><span class="line-number">379</span><br><span class="line-number">380</span><br><span class="line-number">381</span><br><span class="line-number">382</span><br><span class="line-number">383</span><br></div></div><h2 id="_4-启动项目"><a href="#_4-启动项目" class="header-anchor">#</a> 4 启动项目</h2> <blockquote><p>进入到hydra项目根目录执行以下命令 更多命令请参考main.exe -h</p></blockquote> <div class="language-go line-numbers-mode"><pre class="language-go"><code>main<span class="token punctuation">.</span>exe serve all <span class="token operator">--</span>config <span class="token punctuation">.</span><span class="token operator">/</span>docs<span class="token operator">/</span>config<span class="token punctuation">.</span>yaml
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><a data-fancybox="" title="启动项目成功" href="/img/goImage/hydra3.png"><img src="/img/goImage/hydra3.png" alt="启动项目成功"></a></p> <h2 id="_5-查看项目接口文档"><a href="#_5-查看项目接口文档" class="header-anchor">#</a> 5 查看项目接口文档</h2> <blockquote><p>进入到hydra项目根目录执行以下命令 更多命令请参考swagger -h</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>swagger serve -F<span class="token operator">=</span>swagger ./docs/api.swagger.json
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><a data-fancybox="" title="项目接口文档" href="/img/goImage/hydra4.png"><img src="/img/goImage/hydra4.png" alt="项目接口文档"></a></p> <h2 id="_6-前端项目"><a href="#_6-前端项目" class="header-anchor">#</a> 6 前端项目</h2> <p><a href="https://github.com/ory/hydra-login-consent-node" target="_blank" rel="noopener noreferrer">hydra-login-consent-node下载<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h3 id="_6-1-配置文件说明"><a href="#_6-1-配置文件说明" class="header-anchor">#</a> 6.1 配置文件说明</h3> <blockquote><p>绑定后端服务器地址，配置文件位置在hydra-login-consent-node-master/services/hydra.js,如下图</p></blockquote> <p><a data-fancybox="" title="前端页面配置说明" href="/img/goImage/hydra7.png"><img src="/img/goImage/hydra7.png" alt="前端页面配置说明"></a></p> <h3 id="_6-2-前端目录结构说明"><a href="#_6-2-前端目录结构说明" class="header-anchor">#</a> 6.2 前端目录结构说明</h3> <p><a data-fancybox="" title="前端目录结构说明" href="/img/goImage/hydra8.png"><img src="/img/goImage/hydra8.png" alt="前端目录结构说明"></a></p> <h2 id="_7-部分接口说明"><a href="#_7-部分接口说明" class="header-anchor">#</a> 7 部分接口说明</h2> <h3 id="_7-1-流程图说明"><a href="#_7-1-流程图说明" class="header-anchor">#</a> 7.1 流程图说明</h3> <p><a data-fancybox="" title="Hydra流程图" href="/img/goImage/hydra_flow.png"><img src="/img/goImage/hydra_flow.png" alt="Hydra流程图"></a></p> <blockquote><p>以下是部分接口文档说明，更多请求参数请参考swagger文档说明</p></blockquote> <h3 id="_7-2-创建oauth2客户端"><a href="#_7-2-创建oauth2客户端" class="header-anchor">#</a> 7.2 创建Oauth2客户端</h3> <h4 id="_7-2-1-接口说明"><a href="#_7-2-1-接口说明" class="header-anchor">#</a> 7.2.1 接口说明</h4> <ul><li>请求方式:POST</li> <li>请求URL:<a href="http://127.0.0.1:4445/clients" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/clients<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4445">127.0.0.1:4445</a>为后台<code>Admin API</code>端点服务</li></ul> <h4 id="_7-2-2-请求参数说明"><a href="#_7-2-2-请求参数说明" class="header-anchor">#</a> 7.2.2 请求参数说明</h4> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>client_id</td> <td>字符串</td> <td>客户端id</td></tr> <tr><td>client_name</td> <td>字符串</td> <td>客户端名称</td></tr> <tr><td>client_secret</td> <td>字符串</td> <td>客户端秘钥</td></tr> <tr><td>client_secret_expires_at</td> <td>字符串</td> <td>客户端秘钥过期时间</td></tr> <tr><td>created_at</td> <td>字符串</td> <td>客户端创建时间</td></tr> <tr><td>frontchannel_logout_session_required</td> <td>字符串</td> <td>是否注销会话 0否，1是</td></tr> <tr><td>scope</td> <td>字符串</td> <td>客户端作用范围</td></tr> <tr><td>token_endpoint_auth_method</td> <td>字符串</td> <td>令牌终结点身份验证方法</td></tr> <tr><td>grant_types</td> <td>字符串</td> <td>授予类型</td></tr> <tr><td>response_types</td> <td>数组</td> <td>响应类型</td></tr> <tr><td>……</td> <td>……</td> <td>……</td></tr></tbody></table> <h4 id="_7-2-3-请求参数举例"><a href="#_7-2-3-请求参数举例" class="header-anchor">#</a> 7.2.3 请求参数举例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span><span class="token string">&quot;what-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span><span class="token string">&quot;whatOAuth2.0&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret&quot;</span><span class="token operator">:</span><span class="token string">&quot;what-secret&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span><span class="token string">&quot;http://127.0.0.1:5555/callback&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span><span class="token string">&quot;2020-01-06T15:09:15.946Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;frontchannel_logout_session_required&quot;</span><span class="token operator">:</span><span class="token boolean">false</span><span class="token punctuation">,</span>
    <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span><span class="token string">&quot;openid offline offline_access&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span><span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span><span class="token string">&quot;2020-01-07T15:09:15.946Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span><span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;client_credentials&quot;</span>
  <span class="token punctuation">]</span><span class="token punctuation">,</span>
   <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;code&quot;</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><h4 id="_7-2-4-客户端创建响应示例"><a href="#_7-2-4-客户端创建响应示例" class="header-anchor">#</a> 7.2.4 客户端创建响应示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;what-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;whatOAuth2.0&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret&quot;</span><span class="token operator">:</span> <span class="token string">&quot;what-secret&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
    <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token string">&quot;client_credentials&quot;</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token string">&quot;code&quot;</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;openid offline offline_access&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;audience&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
    <span class="token property">&quot;owner&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;policy_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;allowed_cors_origins&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
    <span class="token property">&quot;tos_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;http://127.0.0.1:5555/callback&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;logo_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;contacts&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
    <span class="token property">&quot;subject_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;public&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span> <span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-07T07:30:11Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-07T07:30:11Z&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br></div></div><h3 id="_7-3-获取oauth2客户端列表"><a href="#_7-3-获取oauth2客户端列表" class="header-anchor">#</a> 7.3 获取Oauth2客户端列表</h3> <h4 id="_7-3-1-接口说明"><a href="#_7-3-1-接口说明" class="header-anchor">#</a> 7.3.1 接口说明</h4> <ul><li>请求方式:GET</li> <li>请求URL:<a href="http://127.0.0.1:4445/clients" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/clients<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4445">127.0.0.1:4445</a>为后台<code>Admin API</code>端点服务</li></ul> <h4 id="_7-3-2-响应示例"><a href="#_7-3-2-响应示例" class="header-anchor">#</a> 7.3.2 响应示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
        <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;auth-code-client&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;http://127.0.0.1:5555/callback&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;authorization_code&quot;</span><span class="token punctuation">,</span>
            <span class="token string">&quot;refresh_token&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span>
            <span class="token string">&quot;id_token&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;openid offline&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;audience&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;owner&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;policy_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;allowed_cors_origins&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;tos_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;logo_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;contacts&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
        <span class="token property">&quot;subject_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;public&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span> <span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T03:01:30Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T03:01:30Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;metadata&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">{</span>
        <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;bbb-client&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;http://127.0.0.1:3000/login&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;authorization_code&quot;</span><span class="token punctuation">,</span>
            <span class="token string">&quot;refresh_token&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span>
            <span class="token string">&quot;id_token&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;openid offline&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;audience&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;owner&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;policy_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;allowed_cors_origins&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;tos_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;logo_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;contacts&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
        <span class="token property">&quot;subject_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;public&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span> <span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T08:22:33Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T08:22:33Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;metadata&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">{</span>
        <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;ccc-client&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;client_credentials&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;code&quot;</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;openid offline offline_access&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;audience&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;owner&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;policy_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;allowed_cors_origins&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;tos_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;logo_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;contacts&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
        <span class="token property">&quot;subject_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;public&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span> <span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T09:29:16Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-06T09:29:16Z&quot;</span><span class="token punctuation">,</span>
        <span class="token property">&quot;metadata&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br></div></div><h3 id="_7-4-获取单个oauth2客户端"><a href="#_7-4-获取单个oauth2客户端" class="header-anchor">#</a> 7.4 获取单个Oauth2客户端</h3> <h4 id="_7-4-1-接口说明"><a href="#_7-4-1-接口说明" class="header-anchor">#</a> 7.4.1 接口说明</h4> <ul><li>请求方式:GET</li> <li>请求URL:<a href="http://127.0.0.1:4445/clients/%7Bid%7D" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/clients/{id}<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4445">127.0.0.1:4445</a>为后台<code>Admin API</code>端点服务</li></ul> <h4 id="_7-4-2-请求参数"><a href="#_7-4-2-请求参数" class="header-anchor">#</a> 7.4.2 请求参数</h4> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>id</td> <td>字符串</td> <td>客户端id，必填项</td></tr></tbody></table> <h4 id="_7-4-3-请求举例"><a href="#_7-4-3-请求举例" class="header-anchor">#</a> 7.4.3 请求举例</h4> <p><a href="http://127.0.0.1:4445/clients/xxx-client" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/clients/xxx-client<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h4 id="_7-4-4-响应示例"><a href="#_7-4-4-响应示例" class="header-anchor">#</a> 7.4.4 响应示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;xxx-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;xxxOAuth2.0&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;openid offline offline_access&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;audience&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;owner&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;policy_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;allowed_cors_origins&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;tos_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;http://127.0.0.1:5555/callback&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;logo_uri&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;contacts&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
    <span class="token property">&quot;subject_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;public&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span> <span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-07T06:25:53Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2020-01-07T06:25:53Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;frontchannel_logout_session_required&quot;</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
    <span class="token property">&quot;metadata&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br></div></div><h3 id="_7-5-客户端凭据授予"><a href="#_7-5-客户端凭据授予" class="header-anchor">#</a> 7.5 客户端凭据授予</h3> <h4 id="_7-5-1-接口说明"><a href="#_7-5-1-接口说明" class="header-anchor">#</a> 7.5.1 接口说明</h4> <ul><li>请求方式:POST</li> <li>请求URL:<a href="http://127.0.0.1:4444/oauth2/token" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4444/oauth2/token<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4444">127.0.0.1:4444</a>为后台<code>公共API端点服务</code></li></ul> <h4 id="_7-5-2-请求参数"><a href="#_7-5-2-请求参数" class="header-anchor">#</a> 7.5.2 请求参数</h4> <blockquote><p>客户端通过 使用添加Header参数 Content-Type=&quot;application/x-www-form-urlencoded”
请求实体主体发送以下参数来向令牌端点发出请求。注：以下参数请求使用form-data</p></blockquote> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>grant_type</td> <td>字符串</td> <td>授予类型，必填项</td></tr> <tr><td>refresh_token</td> <td>字符串</td> <td>刷新令牌</td></tr> <tr><td>client_id</td> <td>字符串</td> <td>客户端id，必填项</td></tr> <tr><td>client-secret</td> <td>字符串</td> <td>客户端秘钥，必填项</td></tr> <tr><td>redirect_uri</td> <td>字符串</td> <td>重定向uri</td></tr></tbody></table> <h4 id="_7-5-3-凭据授予后台bug"><a href="#_7-5-3-凭据授予后台bug" class="header-anchor">#</a> 7.5.3 凭据授予后台BUG</h4> <p><strong>客户端凭据授予时会出现以下bug</strong></p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;error&quot;</span><span class="token operator">:</span><span class="token string">&quot;invalid_client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;error_description&quot;</span><span class="token operator">:</span><span class="token string">&quot;Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method)&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;status_code&quot;</span><span class="token operator">:</span><span class="token number">401</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p><strong>原因是Hydra源码授权代码问题。解决方案如下：</strong></p> <blockquote><p>修改$GOPATH$/pkg/mod/github.com/ory/fosite@v0.30.2/client_authentication.go文件190行左右代码，
else if ok &amp;&amp; form.Get(&quot;client_id&quot;) != &quot;&quot; &amp;&amp; form.Get(&quot;client_secret&quot;) != &quot;&quot;判断有误，修改为下面代码</p></blockquote> <div class="language-go line-numbers-mode"><pre class="language-go"><code><span class="token keyword">if</span> oidcClient<span class="token punctuation">,</span> ok <span class="token operator">:=</span> client<span class="token punctuation">.</span><span class="token punctuation">(</span>OpenIDConnectClient<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token operator">!</span>ok <span class="token punctuation">{</span>
    <span class="token comment">// If this isn't an OpenID Connect client then we actually don't care about any of this, just continue!</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> ok <span class="token operator">&amp;&amp;</span> form<span class="token punctuation">.</span><span class="token function">Get</span><span class="token punctuation">(</span><span class="token string">&quot;client_id&quot;</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token string">&quot;&quot;</span> <span class="token operator">&amp;&amp;</span> form<span class="token punctuation">.</span><span class="token function">Get</span><span class="token punctuation">(</span><span class="token string">&quot;client_secret&quot;</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token string">&quot;&quot;</span> <span class="token operator">&amp;&amp;</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token string">&quot;client_secret_post&quot;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token boolean">nil</span><span class="token punctuation">,</span> errors<span class="token punctuation">.</span><span class="token function">WithStack</span><span class="token punctuation">(</span>ErrInvalidClient<span class="token punctuation">.</span><span class="token function">WithHintf</span><span class="token punctuation">(</span><span class="token string">&quot;The OAuth 2.0 Client supports client authentication method \&quot;%s\&quot;, but method \&quot;client_secret_post\&quot; was requested. You must configure the OAuth 2.0 client's \&quot;token_endpoint_auth_method\&quot; value to accept \&quot;client_secret_post\&quot;.&quot;</span><span class="token punctuation">,</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token boolean">_</span><span class="token punctuation">,</span> <span class="token boolean">_</span><span class="token punctuation">,</span> basicOk <span class="token operator">:=</span> r<span class="token punctuation">.</span><span class="token function">BasicAuth</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> basicOk <span class="token operator">&amp;&amp;</span> ok <span class="token operator">&amp;&amp;</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token string">&quot;client_secret_basic&quot;</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token boolean">nil</span><span class="token punctuation">,</span> errors<span class="token punctuation">.</span><span class="token function">WithStack</span><span class="token punctuation">(</span>ErrInvalidClient<span class="token punctuation">.</span><span class="token function">WithHintf</span><span class="token punctuation">(</span><span class="token string">&quot;The OAuth 2.0 Client supports client authentication method \&quot;%s\&quot;, but method \&quot;client_secret_basic\&quot; was requested. You must configure the OAuth 2.0 client's \&quot;token_endpoint_auth_method\&quot; value to accept \&quot;client_secret_basic\&quot;.&quot;</span><span class="token punctuation">,</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> ok <span class="token operator">&amp;&amp;</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token string">&quot;none&quot;</span> <span class="token operator">&amp;&amp;</span> client<span class="token punctuation">.</span><span class="token function">IsPublic</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token boolean">nil</span><span class="token punctuation">,</span> errors<span class="token punctuation">.</span><span class="token function">WithStack</span><span class="token punctuation">(</span>ErrInvalidClient<span class="token punctuation">.</span><span class="token function">WithHintf</span><span class="token punctuation">(</span><span class="token string">&quot;The OAuth 2.0 Client supports client authentication method \&quot;%s\&quot;, but method \&quot;none\&quot; was requested. You must configure the OAuth 2.0 client's \&quot;token_endpoint_auth_method\&quot; value to accept \&quot;none\&quot;.&quot;</span><span class="token punctuation">,</span> oidcClient<span class="token punctuation">.</span><span class="token function">GetTokenEndpointAuthMethod</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h4 id="_7-5-4-凭据授予成功示例"><a href="#_7-5-4-凭据授予成功示例" class="header-anchor">#</a> 7.5.4 凭据授予成功示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;access_token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;n5236wH87fpCoZ4AQc8QPhpysu9pDbtBH6ilZr0DwdU.lCYGIa1g48xuXzb7xj2leVSn7ACOgwWhpVxDBG9g9OI&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;expires_in&quot;</span><span class="token operator">:</span> <span class="token number">3599</span><span class="token punctuation">,</span>
    <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;bearer&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h3 id="_7-6-对access-token自省"><a href="#_7-6-对access-token自省" class="header-anchor">#</a> 7.6 对access_token自省</h3> <h4 id="_7-6-1-接口说明"><a href="#_7-6-1-接口说明" class="header-anchor">#</a> 7.6.1 接口说明</h4> <ul><li>请求方式:POST</li> <li>请求URL:<a href="http://127.0.0.1:4445/oauth2/introspect" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/oauth2/introspect<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4445">127.0.0.1:4445</a>为后台<code>Admin API</code>端点服务</li></ul> <h4 id="_7-6-2-请求参数"><a href="#_7-6-2-请求参数" class="header-anchor">#</a> 7.6.2 请求参数</h4> <p>注：以下参数请求使用form-data</p> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>token</td> <td>字符串</td> <td>access_token，必填项</td></tr> <tr><td>scope</td> <td>字符串</td> <td>客户端作用范围</td></tr></tbody></table> <h4 id="_7-6-3-响应示例"><a href="#_7-6-3-响应示例" class="header-anchor">#</a> 7.6.3 响应示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;active&quot;</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span> <span class="token string">&quot;what-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;sub&quot;</span><span class="token operator">:</span> <span class="token string">&quot;what-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;exp&quot;</span><span class="token operator">:</span> <span class="token number">1578412753</span><span class="token punctuation">,</span>
    <span class="token property">&quot;iat&quot;</span><span class="token operator">:</span> <span class="token number">1578409154</span><span class="token punctuation">,</span>
    <span class="token property">&quot;iss&quot;</span><span class="token operator">:</span> <span class="token string">&quot;https://localhost:4444/&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;access_token&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h3 id="_7-7-oauth2-0授权代码授予"><a href="#_7-7-oauth2-0授权代码授予" class="header-anchor">#</a> 7.7 OAuth2.0授权代码授予</h3> <blockquote><p>我们将执行OAuth 2.0授权代码授予。为此，我们必须首先创建一个能够执行该授权的客户端</p></blockquote> <h4 id="_7-7-1-接口说明"><a href="#_7-7-1-接口说明" class="header-anchor">#</a> 7.7.1 接口说明</h4> <ul><li>请求方式:POST</li> <li>请求URL:<a href="http://127.0.0.1:4445/clients" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4445/clients<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4445">127.0.0.1:4445</a>为后台<code>Admin API</code>端点服务</li></ul> <h4 id="_7-7-2-请求参数"><a href="#_7-7-2-请求参数" class="header-anchor">#</a> 7.7.2 请求参数</h4> <blockquote><p>客户端通过 使用添加Header参数 Content-Type=&quot;application/x-www-form-urlencoded”
。OAuth2.0授权代码授予。特别注意：以下参数请求使用form-data ,此处的client_id是根据上面的客户端秘钥client-secret
自己从新创建的一个OAuth2.0端的id</p></blockquote> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>client_id</td> <td>字符串</td> <td>客户端id</td></tr> <tr><td>client_name</td> <td>字符串</td> <td>客户端名称</td></tr> <tr><td>client_secret</td> <td>字符串</td> <td>客户端秘钥</td></tr> <tr><td>client_secret_expires_at</td> <td>字符串</td> <td>客户端秘钥过期时间</td></tr> <tr><td>created_at</td> <td>字符串</td> <td>客户端创建时间</td></tr> <tr><td>frontchannel_logout_session_required</td> <td>字符串</td> <td>是否注销会话 0否，1是</td></tr> <tr><td>scope</td> <td>字符串</td> <td>客户端作用范围</td></tr> <tr><td>token_endpoint_auth_method</td> <td>字符串</td> <td>令牌终结点身份验证方法</td></tr> <tr><td>grant_types</td> <td>字符串</td> <td>授予类型</td></tr> <tr><td>response_types</td> <td>数组</td> <td>响应类型</td></tr> <tr><td>……</td> <td>……</td> <td>……</td></tr></tbody></table> <h4 id="_7-7-3-请求参数示例"><a href="#_7-7-3-请求参数示例" class="header-anchor">#</a> 7.7.3 请求参数示例</h4> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;client_id&quot;</span><span class="token operator">:</span><span class="token string">&quot;auth-what-client&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_name&quot;</span><span class="token operator">:</span><span class="token string">&quot;auth-whatOAuth2.0&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret&quot;</span><span class="token operator">:</span><span class="token string">&quot;what-secret&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;client_secret_expires_at&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">,</span>
     <span class="token property">&quot;redirect_uris&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;http://127.0.0.1:5555/callback&quot;</span>
  <span class="token punctuation">]</span><span class="token punctuation">,</span>
    
    <span class="token property">&quot;created_at&quot;</span><span class="token operator">:</span><span class="token string">&quot;2020-01-06T15:09:15.946Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;frontchannel_logout_session_required&quot;</span><span class="token operator">:</span><span class="token boolean">false</span><span class="token punctuation">,</span>
    <span class="token property">&quot;scope&quot;</span><span class="token operator">:</span><span class="token string">&quot;openid offline offline_access&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;token_endpoint_auth_method&quot;</span><span class="token operator">:</span><span class="token string">&quot;client_secret_basic&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;updated_at&quot;</span><span class="token operator">:</span><span class="token string">&quot;2020-01-07T15:09:15.946Z&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;userinfo_signed_response_alg&quot;</span><span class="token operator">:</span><span class="token string">&quot;none&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;grant_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;authorization_code&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;refresh_token&quot;</span>
  <span class="token punctuation">]</span><span class="token punctuation">,</span>
   <span class="token property">&quot;response_types&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;id_token&quot;</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div><h3 id="_7-8-执行oauth2-0授权代码流"><a href="#_7-8-执行oauth2-0授权代码流" class="header-anchor">#</a> 7.8 执行OAuth2.0授权代码流</h3> <blockquote><p>以下命令将启动前端Web应用程序的服务器。该应用程序将使用ORY Hydra执行OAuth 2.0授权代码流。</p></blockquote> <h4 id="_7-8-1-接口说明"><a href="#_7-8-1-接口说明" class="header-anchor">#</a> 7.8.1 接口说明</h4> <ul><li>请求方式:POST</li> <li>请求URL:<a href="http://127.0.0.1:4444/oauth2/auth" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4444/oauth2/auth<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>注：<a href="127.0.0.1:4444">127.0.0.1:4444</a>为后台<code>公共API端点服务</code></li></ul> <h4 id="_7-8-2-请求参数"><a href="#_7-8-2-请求参数" class="header-anchor">#</a> 7.8.2 请求参数</h4> <blockquote><p>客户端通过 使用添加Header参数 Content-Type=&quot;application/x-www-form-urlencoded”
。OAuth2.0授权代码授予。特别注意：以下参数请求使用form-data ,此处的client_id是根据上面的客户端秘钥client-secret
自己从新创建的一个OAuth2.0端的id</p></blockquote> <table><thead><tr><th>请求参数</th> <th>参数类型</th> <th>参数说明</th></tr></thead> <tbody><tr><td>client_id</td> <td>字符串</td> <td>OAuth2.0端id，不同于客户端id,必填项</td></tr> <tr><td>client_secret</td> <td>字符串</td> <td>客户端秘钥，必填项</td></tr> <tr><td>scope</td> <td>字符串</td> <td>客户端作用域 必填项openid,offline</td></tr></tbody></table> <h2 id="_8-数据库设计文档"><a href="#_8-数据库设计文档" class="header-anchor">#</a> 8 数据库设计文档</h2> <h3 id="_8-1-客户端数据表hydra-client"><a href="#_8-1-客户端数据表hydra-client" class="header-anchor">#</a> 8.1 客户端数据表hydra_client</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">客户端id</td></tr> <tr><td style="text-align:left;">client_name</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端名称</td></tr> <tr><td style="text-align:left;">client_secret</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端秘钥</td></tr> <tr><td style="text-align:left;">redirect_uris</td> <td style="text-align:left;">text</td> <td style="text-align:left;">重定向uri</td></tr> <tr><td style="text-align:left;">grant_types</td> <td style="text-align:left;">text</td> <td style="text-align:left;">授予类型</td></tr> <tr><td style="text-align:left;">response_types</td> <td style="text-align:left;">text</td> <td style="text-align:left;">响应类型</td></tr> <tr><td style="text-align:left;">scope</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端作用范围</td></tr> <tr><td style="text-align:left;">owner</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端拥有者</td></tr> <tr><td style="text-align:left;">policy_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">策略uri</td></tr> <tr><td style="text-align:left;">tos_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">tos_uri</td></tr> <tr><td style="text-align:left;">client_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端uri</td></tr> <tr><td style="text-align:left;">logo_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">logo_uri</td></tr> <tr><td style="text-align:left;">contacts</td> <td style="text-align:left;">text</td> <td style="text-align:left;">客户端联络</td></tr> <tr><td style="text-align:left;">client_secret_expires_at</td> <td style="text-align:left;">int(11)</td> <td style="text-align:left;">客户端秘钥过期时间</td></tr> <tr><td style="text-align:left;">sector_identifier_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">扇区标识符</td></tr> <tr><td style="text-align:left;">jwks</td> <td style="text-align:left;">text</td> <td style="text-align:left;">json web密钥集</td></tr> <tr><td style="text-align:left;">jwks_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">json web密钥集uri</td></tr> <tr><td style="text-align:left;">request_uris</td> <td style="text-align:left;">text</td> <td style="text-align:left;">请求URIS</td></tr> <tr><td style="text-align:left;">token_endpoint_auth_method</td> <td style="text-align:left;">varchar(25)</td> <td style="text-align:left;">令牌终结点身份验证方法</td></tr> <tr><td style="text-align:left;">request_object_signing_alg</td> <td style="text-align:left;">varchar(10)</td> <td style="text-align:left;">请求对象签名</td></tr> <tr><td style="text-align:left;">userinfo_signed_response_alg</td> <td style="text-align:left;">varchar(10)</td> <td style="text-align:left;">用户信息签名响应</td></tr> <tr><td style="text-align:left;">subject_type</td> <td style="text-align:left;">varchar(15)</td> <td style="text-align:left;">主题类型</td></tr> <tr><td style="text-align:left;">allowed_cors_origins</td> <td style="text-align:left;">text</td> <td style="text-align:left;">允许跨域起源</td></tr> <tr><td style="text-align:left;">pk</td> <td style="text-align:left;">int(10)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">audience</td> <td style="text-align:left;">text</td> <td style="text-align:left;">访客</td></tr> <tr><td style="text-align:left;">created_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">创建时间</td></tr> <tr><td style="text-align:left;">updated_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">更新时间</td></tr> <tr><td style="text-align:left;">frontchannel_logout_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">前置频道注销uri</td></tr> <tr><td style="text-align:left;">frontchannel_logout_session_required</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">需要前置频道注销会话</td></tr> <tr><td style="text-align:left;">post_logout_redirect_uris</td> <td style="text-align:left;">text</td> <td style="text-align:left;">退出后重定向uri</td></tr> <tr><td style="text-align:left;">backchannel_logout_uri</td> <td style="text-align:left;">text</td> <td style="text-align:left;">退出后频道uri</td></tr> <tr><td style="text-align:left;">backchannel_logout_session_required</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">需要退出会话</td></tr> <tr><td style="text-align:left;">metadata</td> <td style="text-align:left;">text</td> <td style="text-align:left;">元数据</td></tr></tbody></table> <h3 id="_8-2-客户端迁移表hydra-client-migration"><a href="#_8-2-客户端迁移表hydra-client-migration" class="header-anchor">#</a> 8.2 客户端迁移表hydra_client_migration</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">applied_at</td> <td style="text-align:left;">datetime</td> <td style="text-align:left;">迁移应用时间</td></tr></tbody></table> <h3 id="_8-3-jsonweb密钥数据表hydra-jwk"><a href="#_8-3-jsonweb密钥数据表hydra-jwk" class="header-anchor">#</a> 8.3 jsonWeb密钥数据表hydra_jwk</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">sid</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">token类型标识id</td></tr> <tr><td style="text-align:left;">kid</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">秘钥id</td></tr> <tr><td style="text-align:left;">version</td> <td style="text-align:left;">int(11)</td> <td style="text-align:left;">版本号</td></tr> <tr><td style="text-align:left;">keydata</td> <td style="text-align:left;">text</td> <td style="text-align:left;">秘钥数据</td></tr> <tr><td style="text-align:left;">created_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">创建时间</td></tr> <tr><td style="text-align:left;">pk</td> <td style="text-align:left;">int(10)</td> <td style="text-align:left;">主键</td></tr></tbody></table> <h3 id="_8-4-jsonweb密钥迁移表hydra-jwk-migration"><a href="#_8-4-jsonweb密钥迁移表hydra-jwk-migration" class="header-anchor">#</a> 8.4 jsonWeb密钥迁移表hydra_jwk_migration</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">applied_at</td> <td style="text-align:left;">datetime</td> <td style="text-align:left;">迁移应用时间</td></tr></tbody></table> <h3 id="_8-5-客户端授权码表hydra-oauth2-access"><a href="#_8-5-客户端授权码表hydra-oauth2-access" class="header-anchor">#</a> 8.5  客户端授权码表hydra_oauth2_access</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">signature</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">签名</td></tr> <tr><td style="text-align:left;">request_id</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">请求id</td></tr> <tr><td style="text-align:left;">requested_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">请求时间</td></tr> <tr><td style="text-align:left;">client_id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">客户端id （表hydra_client的id）</td></tr> <tr><td style="text-align:left;">scope</td> <td style="text-align:left;">text</td> <td style="text-align:left;">作用范围</td></tr> <tr><td style="text-align:left;">granted_scope</td> <td style="text-align:left;">text</td> <td style="text-align:left;">授予范围</td></tr> <tr><td style="text-align:left;">form_data</td> <td style="text-align:left;">text</td> <td style="text-align:left;">表单数据</td></tr> <tr><td style="text-align:left;">session_data</td> <td style="text-align:left;">text</td> <td style="text-align:left;">session数据</td></tr> <tr><td style="text-align:left;">subject</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主题</td></tr> <tr><td style="text-align:left;">active</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">是否有效</td></tr> <tr><td style="text-align:left;">requested_audience</td> <td style="text-align:left;">text</td> <td style="text-align:left;">请求的访客</td></tr> <tr><td style="text-align:left;">granted_audience</td> <td style="text-align:left;">text</td> <td style="text-align:left;">授予访客</td></tr> <tr><td style="text-align:left;">challenge_id</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">挑战id 表hydra_oauth2_consent_request_handled的challenge字段</td></tr></tbody></table> <h3 id="_8-6-同意认证迁移表hydra-oauth2-authentication-consent-migration"><a href="#_8-6-同意认证迁移表hydra-oauth2-authentication-consent-migration" class="header-anchor">#</a> 8.6 同意认证迁移表hydra_oauth2_authentication_consent_migration</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">applied_at</td> <td style="text-align:left;">datetime</td> <td style="text-align:left;">迁移应用时间</td></tr></tbody></table> <h3 id="_8-7-身份验证请求表-hydra-oauth2-authentication-request"><a href="#_8-7-身份验证请求表-hydra-oauth2-authentication-request" class="header-anchor">#</a> 8.7 身份验证请求表 hydra_oauth2_authentication_request</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">challenge</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">requested_scope</td> <td style="text-align:left;">text</td> <td style="text-align:left;">请求范围</td></tr> <tr><td style="text-align:left;">verifier</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">验证者id</td></tr> <tr><td style="text-align:left;">csrf</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">Cross—SiteRequestForger</td></tr> <tr><td style="text-align:left;">subject</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主题</td></tr> <tr><td style="text-align:left;">request_url</td> <td style="text-align:left;">text</td> <td style="text-align:left;">请求url</td></tr> <tr><td style="text-align:left;">skip</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">是否跳过</td></tr> <tr><td style="text-align:left;">client_id</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">客户端id ，表hydra_client的id</td></tr> <tr><td style="text-align:left;">requested_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">请求时间</td></tr> <tr><td style="text-align:left;">authenticated_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">验证时间</td></tr> <tr><td style="text-align:left;">oidc_context</td> <td style="text-align:left;">text</td> <td style="text-align:left;">OIDC上下文</td></tr> <tr><td style="text-align:left;">login_session_id</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">登录session的id，表hydra_oauth2_authentication_session的id</td></tr> <tr><td style="text-align:left;">requested_at_audience</td> <td style="text-align:left;">text</td> <td style="text-align:left;">请求的访客</td></tr></tbody></table> <h3 id="_8-8-已处理身份验证请求hydra-oauth2-authentication-request-handled"><a href="#_8-8-已处理身份验证请求hydra-oauth2-authentication-request-handled" class="header-anchor">#</a> 8.8 已处理身份验证请求hydra_oauth2_authentication_request_handled</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">challenge</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">subject</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主题</td></tr> <tr><td style="text-align:left;">remember</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">是否记住</td></tr> <tr><td style="text-align:left;">remember_for</td> <td style="text-align:left;">int(11)</td> <td style="text-align:left;">记住时间</td></tr> <tr><td style="text-align:left;">error</td> <td style="text-align:left;">text</td> <td style="text-align:left;">错误数据</td></tr> <tr><td style="text-align:left;">acr</td> <td style="text-align:left;">text</td> <td style="text-align:left;">acr</td></tr> <tr><td style="text-align:left;">requested_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">已完成请求时间</td></tr> <tr><td style="text-align:left;">authenticated_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">已验证时间</td></tr> <tr><td style="text-align:left;">was_used</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">是否使用</td></tr> <tr><td style="text-align:left;">forced_subject_identifier</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">强制的主题标识符</td></tr> <tr><td style="text-align:left;">context</td> <td style="text-align:left;">text</td> <td style="text-align:left;">已请求的内容</td></tr></tbody></table> <h3 id="_8-9-身份验证会话hydra-oauth2-authentication-session"><a href="#_8-9-身份验证会话hydra-oauth2-authentication-session" class="header-anchor">#</a> 8.9 身份验证会话hydra_oauth2_authentication_session</h3> <table><thead><tr><th style="text-align:left;">字段名称</th> <th style="text-align:left;">字段类型</th> <th style="text-align:left;">参数说明</th></tr></thead> <tbody><tr><td style="text-align:left;">id</td> <td style="text-align:left;">varchar(40)</td> <td style="text-align:left;">主键id</td></tr> <tr><td style="text-align:left;">authenticated_at</td> <td style="text-align:left;">timestamp</td> <td style="text-align:left;">已验证会话时间</td></tr> <tr><td style="text-align:left;">subject</td> <td style="text-align:left;">varchar(255)</td> <td style="text-align:left;">主题</td></tr> <tr><td style="text-align:left;">remember</td> <td style="text-align:left;">tinyint(1)</td> <td style="text-align:left;">是否记忆</td></tr></tbody></table> <h2 id="_9-oauth2第三方登录示例图"><a href="#_9-oauth2第三方登录示例图" class="header-anchor">#</a> 9 Oauth2第三方登录示例图</h2> <div class="custom-block tip"><p class="custom-block-title">qq账号登录CSDN服务器Oauth2授权说明</p> <ol><li><code>CSDN</code>网站让用户跳转到<code>QQ</code></li> <li><code>QQ</code>要求用户登录(若没有<code>QQ</code>账号，则需要注册)，然后询问&quot;<code>CSDN</code>网站要求获得自己的<code>QQ</code>用户权限，你是否同意？&quot;</li> <li>用户同意，<code>QQ</code>就会重定向回<code>CSDN</code>网站,同时发回一个授权码。</li> <li><code>CSDN</code>网站使用授权码，向<code>QQ</code>请求令牌。</li> <li><code>QQ</code>返回令牌。</li> <li><code>CSDN</code>网站使用令牌,向<code>QQ</code>请求用户数据。</li> <li><code>CSDN</code>用<code>QQ</code>用户在<code>CSDN</code>服务器上写博客、评论等</li></ol></div> <p><a data-fancybox="" title="Oauth2第三方登录示例图" href="/img/goImage/oauth2_client.png"><img src="/img/goImage/oauth2_client.png" alt="Oauth2第三方登录示例图"></a></p> <h2 id="_10-测试oauth2授权服务"><a href="#_10-测试oauth2授权服务" class="header-anchor">#</a> 10 测试Oauth2授权服务</h2> <h3 id="_10-1-客户端凭据授权方式"><a href="#_10-1-客户端凭据授权方式" class="header-anchor">#</a> 10.1 客户端凭据授权方式</h3> <blockquote><p>Client Credentials Grant这种类型是最简化的，Client直接定义自己的client_id而不是Resource owner的名义去要求访问Resource server的一些受保护资源。</p></blockquote> <p><a data-fancybox="" title="Client-Credentials" href="/img/goImage/Client-Credentials.png"><img src="/img/goImage/Client-Credentials.png" alt="Client-Credentials"></a></p> <h3 id="_10-2-创建oauth-2-0客户端"><a href="#_10-2-创建oauth-2-0客户端" class="header-anchor">#</a> 10.2 创建OAuth 2.0客户端</h3> <h4><a href="/blog/Go/14%20%20Hydra项目介绍.html#_7-2-创建oauth2客户端" style="display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0px;margin-inline-end:0px;"><strong>创建OAuth2.0客户端示例</strong></a></h4> <h3 id="_10-3-执行客户端凭据"><a href="#_10-3-执行客户端凭据" class="header-anchor">#</a> 10.3 执行客户端凭据</h3> <h4><a href="/blog/Go/14%20%20Hydra项目介绍.html#_7-5-客户端凭据授予" style="display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0px;margin-inline-end:0px;"><strong>执行客户端凭据示例</strong></a></h4> <h3 id="_10-4-执行令牌自省"><a href="#_10-4-执行令牌自省" class="header-anchor">#</a> 10.4 执行令牌自省</h3> <h4><a href="/blog/Go/14%20%20Hydra项目介绍.html#_7-6-对access-token自省" style="display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0px;margin-inline-end:0px;"><strong>执行令牌自省示例</strong></a></h4> <h3 id="_10-5-跳转到登录页面"><a href="#_10-5-跳转到登录页面" class="header-anchor">#</a> 10.5 跳转到登录页面</h3> <blockquote><p>浏览器输入以下地址到后台服务请求，后台服务返回前端的登录页面http://localhost:3000/login?login_challenge=ec2bf8e55a11474392f8867e92624e04</p></blockquote> <div class="language-http request line-numbers-mode"><pre class="language-http"><code><span class="token header-name keyword">http:</span>//127.0.0.1:4444/oauth2/auth?client_id=what-client&amp;scope=offline_access&amp;response_type=code&amp;state=abcdefghigklmn
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>请求参数说明</strong></p> <ul><li>请求方式:GET</li> <li>请求接口:<a href="http://127.0.0.1:4444/oauth2/auth" target="_blank" rel="noopener noreferrer">http://127.0.0.1:4444/oauth2/auth<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li>参数<code>client_id</code>为10.2创建的客户端id</li> <li>参数<code>response_type</code>为响应类型，一般固定response_type=code</li> <li>参数<code>scope</code>为Client的作用范围[openid offline ,offline_access]</li> <li>参数<code>state</code>为Client提供的一个字符串，服务器会原样返回给Client。长度必须大于8位</li> <li>注：<a href="127.0.0.1:4444">127.0.0.1:4444</a>为后台<code>Public API</code>端点服务</li></ul> <p><a data-fancybox="" title="返回前端的登录页面" href="/img/goImage/hydra_login.png"><img src="/img/goImage/hydra_login.png" alt="返回前端的登录页面"></a></p> <h3 id="_10-6-登录页面"><a href="#_10-6-登录页面" class="header-anchor">#</a> 10.6 登录页面</h3> <blockquote><p>输入input框提示的账号密码，点击登录，跳转到成功登录页面,登录接口如下</p></blockquote> <div class="language-http request line-numbers-mode"><pre class="language-http"><code>#登录接口
<span class="token header-name keyword">http:</span>//127.0.0.1:4444/oauth2/auth/requests/login/accept?login_challenge=536e6810083947aab2bb7dda5ee6815a
#验证接口
<span class="token header-name keyword">http:</span>//127.0.0.1:4444/oauth2/auth?client_id=what-client&amp;login_verifier=c7faac0f7b62457d955a00c5d95f65e2&amp;response_type=code&amp;6scope=offline_access&amp;6state=abcdefghiddgklmn
#验证成功返回接口
<span class="token header-name keyword">http:</span>//127.0.0.1:4444/oauth2/auth/requests/consent?consent_challenge=70f9f2402e8b4ea4b07376a9dee22c52
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p><a data-fancybox="" title="登录成功页面" href="/img/goImage/login_success.png"><img src="/img/goImage/login_success.png" alt="登录成功页面"></a></p> <h3 id="项目详细流程说明"><a href="#项目详细流程说明" class="header-anchor">#</a> 项目详细流程说明</h3> <p><a href="https://www.ory.sh/docs/hydra/login-consent-flow" target="_blank" rel="noopener noreferrer">登录、同意和注销官方流程说明<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h2 id="_11-参考资料"><a href="#_11-参考资料" class="header-anchor">#</a> 11 参考资料</h2> <ul><li><a href="https://oauth.net/2/" target="_blank" rel="noopener noreferrer">https://oauth.net/2/<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://www.oauth.com/" target="_blank" rel="noopener noreferrer">https://www.oauth.com/<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://tools.ietf.org/html/rfc6749" target="_blank" rel="noopener noreferrer">RFC6749:OAuth 2.0授权框架<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://github.com/jeansfish/RFC6749.zh-cn" target="_blank" rel="noopener noreferrer">RFC6749中文版<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://www.ory.sh/docs/hydra/" target="_blank" rel="noopener noreferrer">Hydra官方文档说明<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://www.ibm.com/developerworks/cn/security/se-bootstrap-hydra-oauth2/index.html" target="_blank" rel="noopener noreferrer">IBM社区学习如何引导 Hydra<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://github.com/ory/hydra/issues" target="_blank" rel="noopener noreferrer">Github项目问题反馈列表<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://www.cnblogs.com/linianhui/category/929878.html" target="_blank" rel="noopener noreferrer">Oauth2认证和授权参考文档<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/blog/Go/13  权限服务器keto.html" class="prev">
        权限服务器keto
      </a></span> <span class="next"><a href="/blog/Java/springboot事务管理学习总结.html">
        springboot事务管理学习总结
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.1bc80adb.js" defer></script><script src="/assets/js/2.7c0608ab.js" defer></script><script src="/assets/js/38.f76063aa.js" defer></script>
  </body>
</html>
